<template>
	<div class="mine">
		<div class="box">
			<div class="hearderBox">
				<div class="hearderBoxIcon" @click="goBack">
					<img src="../../assets/images/fanhuijiantou.png" alt="">
				</div>
				{{$t('indexTitle.title123')}}
			</div>
			<div class="proNavList">
				<div class="proNavListIt" @click="goNextPage('/changeLoginPassword')">
					{{$t('indexTitle.title55')}}
				</div>
				<div class="proNavListIt" @click="goNextPage('/changeWithdrawalPassword')">
					{{$t('indexTitle.title239')}}
				</div>
			</div>
			<div class="proList">
				<!-- <div class="proListIt">
					<div class="proListItTop">
						推荐码
					</div>
					<div class="proListItBot">

					</div>
				</div> -->
				<div class="proListIt">
					<div class="proListItTop">
						{{$t('indexTitle.title240')}}
					</div>
					<div class="proListItBot">
						{{info.name}}
					</div>
				</div>
				<div class="proListIt">
					<div class="proListItTop">
						{{$t('indexTitle.title241')}}
					</div>
					<div class="proListItBot">
						{{info.zhuanpan}}
					</div>
				</div>
				<div class="proListIt">
					<div class="proListItTop">
						{{$t('indexTitle.title242')}}
					</div>
					<div class="proListItBot">

					</div>
				</div>
				<div class="proListIt">
					<div class="proListItTop">
						{{$t('indexTitle.title243')}}
					</div>
					<div class="proListItBot">
						+98 {{info.phone}}
					</div>
				</div>
				<div class="proListIt">
					<div class="proListItTop">
						{{$t('indexTitle.title244')}}
					</div>
					<div class="proListItBottOW">
						<div class="BriBox" v-if="!isBirShow">
							<div class="proListItBot">
								{{info.birthday}}
							</div>
							<!-- <div class="BriBoxright">
								<img src="../../assets/images/xiugai.png" alt="">
							</div> -->
						</div>
						<div class="BriBox" v-if="isBirShow">
							<div class="BriXiugaiBoxLeft">
								<input type="date" v-model="birthday">
							</div>
							<div class="BriXiugaiBoxright">
								<div class="cuohaoBox" @click="isBirShow=false">
									<img src="../../assets/images/cuohao.png" alt="">
								</div>
								<div class="duihaoBox" @click="getModifyUser">
									<img src="../../assets/images/duihao.png" alt="">
								</div>
							</div>
						</div>
					</div>
				</div>
				<!--<div class="proListIt">
				 <div class="proListItTop">
						Telegram
					</div>
					<div class="proListItBottOW">
						<div class="BriBox">
							<div class="proListItBot">
								12342314
							</div>
							<div class="BriBoxright">
								<img src="../../assets/images/xiugai.png" alt="">
							</div>
						</div>
						<div class="BriXiugaiBox">
							<div class="BriXiugaiBoxLeft">
								<input type="date">
							</div>
							<div class="BriXiugaiBoxright">
								<div class="cuohaoBox">
									<img src="../../assets/images/cuohao.png" alt="">
								</div>
								<div class="duihaoBox">
									<img src="../../assets/images/duihao.png" alt="">
								</div>
							</div>
						</div>
					</div>
				</div> -->
				<div class="proListIt">
					<div class="proListItTop">
						{{$t('indexTitle.title245')}}
					</div>
					<div class="proListItBot">
						{{info.created_at}}
					</div>
				</div>
				<div class="proListIt">
					<div class="proListItTop">
						{{$t('indexTitle.title246')}}
					</div>
					<div class="proListItBot">
						{{info.updated_at}}
					</div>
				</div>
			</div>

		</div>
		<!-- <div class="buttons">
			<img src="../../assets/images/xiaoxi.png" alt="" />
		</div> -->
		<loadingFour :msgText="msgTextTow" v-if="isShowLoadingTeow" @closeGuanbiTow="closeGuanbi"></loadingFour>
	</div>
</template>

<script>
	import {
		userinfo,
		modifyBrithday
	} from "../../utils/api.js"
	import loadingFour from '../../components/loadingFour.vue';
	export default {
		components: {
			loadingFour
		},
		data() {
			return {
				close: true,
				info: [],
				isBirShow: '',
				birthday: '',
				msgTextTow: "",
				isShowLoadingTeow: false
			}
		},
		created() {},
		mounted() {
			if(localStorage.getItem("userInfo")){
				this.info = JSON.parse(localStorage.getItem('userInfo'))
				if (this.info.birthday) {
					this.isBirShow = false;
				} else {
					this.isBirShow = true;
				}
			}
			// this.getuserinfo()
		},
		methods: {
			closeGuanbi(e) {
				this.isShowLoadingTeow = false;
			},
			getuserinfo() {
				this.info = [];
				userinfo().then((res) => {
					if (res.status.errorCode == 0) {
						this.info = res.data
						if (this.info.birthday) {
							this.isBirShow = false;
						} else {
							this.isBirShow = true;
						}
						localStorage.setItem("userInfo", JSON.stringify(this.info))
					} else if (res.status.errorCode == 401) {
						console.log('401')
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
							setTimeout(()=>{
								this.isShowLoadingTeow = false;
							},2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			getModifyUser() {
				let date = {
					date: this.birthday
				}
				modifyBrithday(date).then((res) => {
					if (res.status.errorCode == 0) {
						this.getuserinfo()
						this.isBirShow = false
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
							setTimeout(()=>{
								this.isShowLoadingTeow = false;
							},2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
				console.log(this.birthday);
			},

			goBack() {
				this.$router.go(-1)
			},
			goNextPage(page) {
				this.$router.push(page)
			}
		}
	}
</script>

<style scoped>
	* {
		box-sizing: border-box;
	}

	.mine {
		height: 90vh;
		overflow-y: auto;
		overflow-x: hidden;
		padding-top: calc(constant(safe-area-inset-top) + 0px);
		padding-top: calc(env(safe-area-inset-top) + 0px);
		padding-bottom: calc(constant(safe-area-inset-bottom) + 85px);
		padding-bottom: calc(env(safe-area-inset-bottom) + 85px);
		box-sizing: border-box;
		position: fixed;
		z-index: 1;
		-webkit-overflow-scrolling: touch;
		width: 100%;
	}

	.box {
		background-color: #ffffff;
		display: flex;
		flex-direction: column;
		/* min-height: 100vh; */
	}

	.buttons {
		position: fixed;
		bottom: 10%;
		right: 10px;
		background-color: #99D2E3;
		width: 60px;
		height: 60px;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.buttons img {
		width: 32px;
		height: 32px;
	}


	.hearderBox {
		width: 100%;
		height: 45px;
		background-color: #fff;
		position: fixed;
		top: 0;
		font-weight: 300;
		line-height: 45px;
		text-align: center;
		font-size: 20px;
		color: #545658;
		box-shadow: inset 0 -1px 0 #ececec;
		left: 0;
		overflow: hidden;
		z-index: 9999;
	}

	.hearderBoxIcon {
		width: 50px;
		position: fixed;
		top: 3px;
		left: 0px;
	}

	.hearderBoxIcon img {
		width: 20px;
		height: 20px;
	}

	.proNavList {
		width: 100%;
		box-sizing: border-box;
		display: flex;
		align-items: center;
		justify-content: space-between;
		background: linear-gradient(90deg, #7240ff, #a240ff);
		display: flex;
		justify-content: space-between;
		left: 0;
		padding: 15px;
		position: fixed;
		top: 45px;
		z-index: 15;
	}

	.proNavListIt {
		align-items: center;
		background: #fff;
		border-radius: 5px;
		color: #7240ff;
		cursor: pointer;
		display: flex;
		font-size: 12px;
		font-weight: 500;
		height: 36px;
		justify-content: center;
		width: 48%;
	}

	.proList {
		width: 100%;
		padding: 0px 20px 0;
		margin-top: 110px;
		box-sizing: border-box;
	}

	.proListIt {
		width: 100%;
		padding: 15px 0;
		box-sizing: border-box;
		border-bottom: 1px solid #e9e9e9;
	}

	.proListItTop {
		color: #545658;
		font-size: 10px;
		margin-bottom: 5px;
		opacity: .6;
	}

	.proListItBot {
		font-size: 14px;
		line-height: 1.29;
		min-height: 18px;
		color: #545658;
		font-weight: 300;
	}

	.proListItBottOW {
		width: 100%;
	}

	.BriBox {
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.BriBoxright img {
		width: 20px;
		height: 23px;
	}

	.BriXiugaiBoxLeft {
		width: 76%;
	}

	.BriXiugaiBoxLeft input {
		width: 100%;
		height: 35px;
		position: relative;
		background-color: #f9f9f9;
		border: 1px solid #e0e0e0;
		border-radius: 2px;
		color: #333;
		font-size: 13px;
		padding-left: 8px;
	}

	.BriXiugaiBoxright {
		width: 22%;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.cuohaoBox {
		width: 35px;
		height: 35px;
		display: flex;
		align-items: center;
		justify-content: center;
		background: #ccc;
		border-radius: 5px;
	}

	.cuohaoBox img {
		width: 25px;
		height: 25px;
	}

	.duihaoBox {
		width: 35px;
		height: 35px;
		display: flex;
		align-items: center;
		justify-content: center;
		background: #7240ff;
		border-radius: 5px;
	}

	.duihaoBox img {
		width: 20px;
		height: 20px;
	}

	.BriXiugaiBoxLeft input::-webkit-calendar-picker-indicator {
		position: absolute;
		right: 0;
		padding-left: 100%;
	}
</style>